<template>
  <div class="systemmes-content">
    <div class="main-box" v-for="(item,index) in items" :key="index">
      <div class="jiushibox">
        <div class="sbox">
          <img src="@/assets/img/icon_xtxx_cstx.png" class="tixingicon">
          <div class="tit">{{item.logDesc}}</div>
        </div>
        <div class="time">今天{{ item.addtime.substr(10)}} </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      items: [] //这是我们的超时提醒
    };
  },
  beforeCreate: function() {
    //创建前
  },
  created: function() {
    //创建后
    this.Suk_outtime();
  },
  beforeMount: function() {
    //挂载前
  },
  mounted: function() {
    //挂载后
  },
  beforeUpdate: function() {
    //更新前
  },
  update: function() {
    //更新后
  },
  methods: {
    //超时提醒
    Suk_outtime() {
      let that = this;
      that.$toast.loading({
        message: "加载中..."
      });
      var Sukdata = {
        userId: localStorage.getItem("userid")
      };
      console.log(Sukdata);
      that.axios
        .post(that.baseUrl + "/log/addOvertime", that.Qs.stringify(Sukdata), {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded"
          }
        })
        .then(function(res) {
          if (res.request.status === 200) {
            if (res.data.meta.code == 200) {
              console.log(res.data);
              that.items = res.data.data.list;
              that.Suk_edittp();
              that.$toast.clear();
            } else if (res.data.meta.code == 501) {
            }
          }
        });
    },
    Suk_edittp() {
      let that = this;
      let arr = []
      for(let i=0;i<that.items.length;i++){
        console.log(that.items[i].logId,'id')
        arr.push(that.items[i].logId)
      }
      console.log(arr.join(","),'arr')
      that.$toast.loading({
        message: "加载中..."
      });
      var Sukdata = {
        logId:arr.join(",")
      };
      console.log(Sukdata);
      that.axios
        .post(that.baseUrl + "/log/addCounts", that.Qs.stringify(Sukdata), {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded"
          }
        })
        .then(function(res) {
          if (res.request.status === 200) {
            if (res.data.meta.code == 200) {
              console.log(res.data);
              that.$toast.clear();
            } else if (res.data.meta.code == 501) {
            }
          }
        });
    },
  }
};
</script>
<style lang="scss" scoped>
.systemmes-content {
  font-size: 0.3rem;
}
.jiushibox {
  width: 90%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #f4f4f4;
}
.tixingicon {
  width: 0.733rem;
  vertical-align: center;
}
.tit {
  display: inline-block;
  vertical-align: center;
  text-indent: 0.3rem;
}
.time {
  vertical-align: center;
}
.sbox {
  display: flex;
  align-items: center;
}
</style>
